<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/**
 * 后台菜单 模型
 */
class Admin_menu_model extends MY_Model {

    protected $_table      = 'admin_menu';
    protected $primary_key = 'menu_id';
    protected $parent_key  = 'parent_id';
    protected $return_type = 'array';

    public function __construct() {
        parent::__construct();
        log_message('debug', 'Admin_menu_model Model Class Initialized');
    }

    /**
     * 获取全部菜单
     */
    public function get_all_menus() {
        static $menus = array();
        if ($menus) return $menus;

        foreach ($this->order_by('vieworder')->get_all() as $menu) {
            $menus[$menu[$this->primary_key]] = $menu;
        }
        return $menus;
    }
}

/* End of file admin_menu_model.php */
/* Location: ./application/models/admin_menu_model.php */
